\hypertarget{classsock_1_1base_1_1_thread}{}\section{sock\+:\+:base\+:\+:Thread Class Reference}
\label{classsock_1_1base_1_1_thread}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}


线程类  




{\ttfamily \#include $<$thread.\+h$>$}

Inheritance diagram for sock\+:\+:base\+:\+:Thread\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classsock_1_1base_1_1_thread}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3b}{State} \{ \hyperlink{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba0fd707d5d03ddc089a0bf38d8066f8a9}{R\+E\+A\+D\+Y}, 
\hyperlink{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba9de7b235e51da1a413d3350cbe206214}{R\+U\+N\+N\+I\+N\+G}, 
\hyperlink{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba111a8a5e3bc9f387b6566b7f284ee633}{E\+X\+I\+T}
 \}\begin{DoxyCompactList}\small\item\em 线程状态 \end{DoxyCompactList}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classsock_1_1base_1_1_thread_a3ad909f591333628c22cb5ba10957923}{Thread} (void)
\item 
virtual \hyperlink{classsock_1_1base_1_1_thread_af1e25588ebe47a2a6d79ef8c686a992b}{$\sim$\+Thread} (void)
\item 
void \hyperlink{classsock_1_1base_1_1_thread_aa1ff0068d8e7ab1c8522827b89937611}{start} (void)
\begin{DoxyCompactList}\small\item\em 启动线程，失败抛出异常 \end{DoxyCompactList}\item 
virtual void \hyperlink{classsock_1_1base_1_1_thread_a27853293167cb8128d986dd856a77d8e}{stop} (void)
\begin{DoxyCompactList}\small\item\em 停止线程 \end{DoxyCompactList}\item 
virtual void \hyperlink{classsock_1_1base_1_1_thread_a4b53c0e0df28893e36e92ea0f3723a2f}{run} (void)=0
\begin{DoxyCompactList}\small\item\em 线程执行函数 \end{DoxyCompactList}\item 
void \hyperlink{classsock_1_1base_1_1_thread_ab982afa8abe62f1883fbd199c6f6ac2c}{join} (void)
\begin{DoxyCompactList}\small\item\em 连接线程，等待退出 \end{DoxyCompactList}\item 
\hyperlink{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3b}{State} \hyperlink{classsock_1_1base_1_1_thread_ab9a901de1d721ab3cbaf38978bd1a763}{get\+State} (void) const 
\begin{DoxyCompactList}\small\item\em 获取线程状态 \end{DoxyCompactList}\item 
id \hyperlink{classsock_1_1base_1_1_thread_a5905e1e9f050b4dce88a4da576a7d655}{get\+Id} (void) const 
\begin{DoxyCompactList}\small\item\em 获取线程\+I\+D \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static id \hyperlink{classsock_1_1base_1_1_thread_a8c9a6787ece1b03536a2762920075500}{current\+Tid} (void)
\begin{DoxyCompactList}\small\item\em 获取当前线程\+I\+D \end{DoxyCompactList}\item 
static void \hyperlink{classsock_1_1base_1_1_thread_a10a9bbb6c05e52f32fcfe7138198c80a}{sleep} (int ms)
\begin{DoxyCompactList}\small\item\em 线程休眠 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
线程类 

\subsection{Member Enumeration Documentation}
\hypertarget{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3b}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!State@{State}}
\index{State@{State}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{State}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf sock\+::base\+::\+Thread\+::\+State}}\label{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3b}


线程状态 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{R\+E\+A\+D\+Y@{R\+E\+A\+D\+Y}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!R\+E\+A\+D\+Y@{R\+E\+A\+D\+Y}}\item[{\em 
\hypertarget{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba0fd707d5d03ddc089a0bf38d8066f8a9}{}R\+E\+A\+D\+Y\label{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba0fd707d5d03ddc089a0bf38d8066f8a9}
}]\index{R\+U\+N\+N\+I\+N\+G@{R\+U\+N\+N\+I\+N\+G}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!R\+U\+N\+N\+I\+N\+G@{R\+U\+N\+N\+I\+N\+G}}\item[{\em 
\hypertarget{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba9de7b235e51da1a413d3350cbe206214}{}R\+U\+N\+N\+I\+N\+G\label{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba9de7b235e51da1a413d3350cbe206214}
}]\index{E\+X\+I\+T@{E\+X\+I\+T}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!E\+X\+I\+T@{E\+X\+I\+T}}\item[{\em 
\hypertarget{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba111a8a5e3bc9f387b6566b7f284ee633}{}E\+X\+I\+T\label{classsock_1_1base_1_1_thread_a594bf462100702a1b657eacded576f3ba111a8a5e3bc9f387b6566b7f284ee633}
}]\end{description}
\end{Desc}


\subsection{Constructor \& Destructor Documentation}
\hypertarget{classsock_1_1base_1_1_thread_a3ad909f591333628c22cb5ba10957923}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!Thread@{Thread}}
\index{Thread@{Thread}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{Thread(void)}]{\setlength{\rightskip}{0pt plus 5cm}Thread\+::\+Thread (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{classsock_1_1base_1_1_thread_a3ad909f591333628c22cb5ba10957923}
\hypertarget{classsock_1_1base_1_1_thread_af1e25588ebe47a2a6d79ef8c686a992b}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!````~Thread@{$\sim$\+Thread}}
\index{````~Thread@{$\sim$\+Thread}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{$\sim$\+Thread(void)}]{\setlength{\rightskip}{0pt plus 5cm}Thread\+::$\sim$\+Thread (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classsock_1_1base_1_1_thread_af1e25588ebe47a2a6d79ef8c686a992b}


\subsection{Member Function Documentation}
\hypertarget{classsock_1_1base_1_1_thread_a8c9a6787ece1b03536a2762920075500}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!current\+Tid@{current\+Tid}}
\index{current\+Tid@{current\+Tid}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{current\+Tid(void)}]{\setlength{\rightskip}{0pt plus 5cm}Thread\+::id Thread\+::current\+Tid (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1base_1_1_thread_a8c9a6787ece1b03536a2762920075500}


获取当前线程\+I\+D 

\begin{DoxyReturn}{Returns}
id 
\end{DoxyReturn}
\hypertarget{classsock_1_1base_1_1_thread_a5905e1e9f050b4dce88a4da576a7d655}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!get\+Id@{get\+Id}}
\index{get\+Id@{get\+Id}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{get\+Id(void) const }]{\setlength{\rightskip}{0pt plus 5cm}id sock\+::base\+::\+Thread\+::get\+Id (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classsock_1_1base_1_1_thread_a5905e1e9f050b4dce88a4da576a7d655}


获取线程\+I\+D 

\begin{DoxyReturn}{Returns}
int 
\end{DoxyReturn}
\hypertarget{classsock_1_1base_1_1_thread_ab9a901de1d721ab3cbaf38978bd1a763}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!get\+State@{get\+State}}
\index{get\+State@{get\+State}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{get\+State(void) const }]{\setlength{\rightskip}{0pt plus 5cm}{\bf State} sock\+::base\+::\+Thread\+::get\+State (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}\label{classsock_1_1base_1_1_thread_ab9a901de1d721ab3cbaf38978bd1a763}


获取线程状态 

\begin{DoxyReturn}{Returns}
State 
\end{DoxyReturn}
\hypertarget{classsock_1_1base_1_1_thread_ab982afa8abe62f1883fbd199c6f6ac2c}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!join@{join}}
\index{join@{join}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{join(void)}]{\setlength{\rightskip}{0pt plus 5cm}void Thread\+::join (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{classsock_1_1base_1_1_thread_ab982afa8abe62f1883fbd199c6f6ac2c}


连接线程，等待退出 

\hypertarget{classsock_1_1base_1_1_thread_a4b53c0e0df28893e36e92ea0f3723a2f}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!run@{run}}
\index{run@{run}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{run(void)=0}]{\setlength{\rightskip}{0pt plus 5cm}virtual void sock\+::base\+::\+Thread\+::run (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [pure virtual]}}\label{classsock_1_1base_1_1_thread_a4b53c0e0df28893e36e92ea0f3723a2f}


线程执行函数 



Implemented in \hyperlink{classsock_1_1net_1_1_tcp_worker_ac109fdb1e156de25c7d120d7af0c2ab8}{sock\+::net\+::\+Tcp\+Worker}.

\hypertarget{classsock_1_1base_1_1_thread_a10a9bbb6c05e52f32fcfe7138198c80a}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!sleep@{sleep}}
\index{sleep@{sleep}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{sleep(int ms)}]{\setlength{\rightskip}{0pt plus 5cm}void Thread\+::sleep (
\begin{DoxyParamCaption}
\item[{int}]{ms}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}\label{classsock_1_1base_1_1_thread_a10a9bbb6c05e52f32fcfe7138198c80a}


线程休眠 


\begin{DoxyParams}{Parameters}
{\em ms} & 休眠时间(毫秒) \\
\hline
\end{DoxyParams}
\hypertarget{classsock_1_1base_1_1_thread_aa1ff0068d8e7ab1c8522827b89937611}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!start@{start}}
\index{start@{start}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{start(void)}]{\setlength{\rightskip}{0pt plus 5cm}void Thread\+::start (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{classsock_1_1base_1_1_thread_aa1ff0068d8e7ab1c8522827b89937611}


启动线程，失败抛出异常 

\hypertarget{classsock_1_1base_1_1_thread_a27853293167cb8128d986dd856a77d8e}{}\index{sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}!stop@{stop}}
\index{stop@{stop}!sock\+::base\+::\+Thread@{sock\+::base\+::\+Thread}}
\subsubsection[{stop(void)}]{\setlength{\rightskip}{0pt plus 5cm}void Thread\+::stop (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classsock_1_1base_1_1_thread_a27853293167cb8128d986dd856a77d8e}


停止线程 



Reimplemented in \hyperlink{classsock_1_1net_1_1_tcp_worker_ac8ff72964ca27b1218484530322b2531}{sock\+::net\+::\+Tcp\+Worker}.



The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
E\+:/git/sock/sock/base/\hyperlink{thread_8h}{thread.\+h}\item 
E\+:/git/sock/src/base/\hyperlink{thread_8cc}{thread.\+cc}\end{DoxyCompactItemize}
